// by xcwgf666 #include #include #include using namespace std; int n, k, i, j; long long a[100000 + 5], mx; int main (int argc, char * const argv[]) { scanf("%d %d", &n, &k); assert(1 <= n && n <= 100000 && 0 <= k && k <= 2000000000); // one can prove (or just check) that there is a cycle of the size not greater than two // so the required number of iterations is actually very small, so we can actually do a brute force if (k % 2 == 1) k = 1; else k = min(k, 2); for(i = 1; i <= n; i++) { scanf("%lld", &a[i]); assert(abs(a[i]) <= 2000000000); } for(i = 1; i <= k; i++) { // performing what is described in the problem mx = a[1]; for(j = 2; j <= n; j++) mx = max(mx, a[j]); for(j = 1; j <= n; j++) a[j] = mx - a[j]; } for(i = 1; i < n; i++) printf("%d ", (int)a[i]); printf("%d\n", (int)a[n]); return 0; }